
/**
 * 主接线图
 */
var textWidth;
var ar;
var api=require("./api.js");

Date.prototype.format = function(fmt)
{ 
　　var o = {
　　　　"M+" : this.getMonth()+1, //月份
　　　　"d+" : this.getDate(), //日
　　　　"h+" : this.getHours()%12 == 0 ? 12 : this.getHours()%12, //小时
　　　　"H+" : this.getHours(), //小时
　　　　"m+" : this.getMinutes(), //分
　　　　"s+" : this.getSeconds(), //秒
　　　　"q+" : Math.floor((this.getMonth()+3)/3), //季度
　　　　"S" : this.getMilliseconds() //毫秒
　　};
　　if(/(y+)/.test(fmt))
　　　　fmt=fmt.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length));
　　for(var k in o)
　　　　if(new RegExp("("+ k +")").test(fmt))
　　fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length)));
　　return fmt;
} 
export function drawLine(context, x1, y1, x2, y2) {
	context.beginPath();
	context.moveTo(x1, y1);
	context.lineTo(x2, y2);
	context.stroke();
}

export function jsRgb(rgb) {
	var b = Math.floor(rgb / 65536);
	var g = Math.floor((rgb - b * 65536) / 256);
	var r = rgb % 256;
	var result = 'rgb(' + r + ',' + g + ' ,' + b + ')';
	return result;
}

export function paramEllipse(context, x, y, a, b) {
	var step = (a > b) ? 1 / a : 1 / b;
	context.beginPath();
	context.moveTo(x + a, y);
	for(var i = 0; i < 2 * Math.PI; i += step) {
		context.lineTo(x + a * Math.cos(i), y + b * Math.sin(i));
	}
	context.closePath();
	context.stroke();
}

// 封装的一个用于绘制圆角矩形的函数.
export function roundedRect(context,x,y,width,height,radius){
	context.beginPath();
	context.moveTo(x,y+radius);
	context.lineTo(x,y+height-radius);
	context.quadraticCurveTo(x,y+height,x+radius,y+height);
	context.lineTo(x+width-radius,y+height);
	context.quadraticCurveTo(x+width,y+height,x+width,y+height-radius);
	context.lineTo(x+width,y+radius);
	context.quadraticCurveTo(x+width,y,x+width-radius,y);
	context.lineTo(x+radius,y);
	context.quadraticCurveTo(x,y,x,y+radius);
	context.fill();
}

export function draw(canvas, context, drawStruct,clickXY ) {
	context.strokeStyle = jsRgb(drawStruct.color);
	context.fillStyle = jsRgb(drawStruct.bkColor);
	context.lineWidth = drawStruct.penWidth;
	switch (drawStruct.mpyclass) {
		case 1:
			context.fillStyle = jsRgb(drawStruct.color);
			context.lineWidth = drawStruct.penWidth;
			context.beginPath();
			if (drawStruct.mykind==0) {
				context.moveTo(drawStruct.left, drawStruct.top+ 5);
				context.lineTo(drawStruct.left+ drawStruct.width, drawStruct.top+ 5);
			} else {
				context.moveTo(drawStruct.left, drawStruct.top+ 5);
				context.lineTo(drawStruct.left+ drawStruct.width, drawStruct.top+ 5);
			}
			context.stroke();
			break;
		case 2:
			context.fillStyle = jsRgb(drawStruct.color);
			context.beginPath();
			if (drawStruct.mykind==0) {
				context.moveTo(drawStruct.left+ 4, drawStruct.top);
				context.lineTo(drawStruct.left+ 4, drawStruct.top + drawStruct.height);
			} else {
				context.moveTo(drawStruct.left+ 4, drawStruct.top);
				context.lineTo(drawStruct.left+ 4, drawStruct.top+ drawStruct.height);
			}
			context.stroke();
			break;
		case 3:
		case 4:
			context.fillRect(drawStruct.left, drawStruct.top, drawStruct.width, drawStruct.height);
			context.strokeRect(drawStruct.left, drawStruct.top, drawStruct.width, drawStruct.height);
			break;
		case 5:
			if (drawStruct.dTranparent == 0) {
				if (drawStruct.mykind == 0) {
					context.strokeStyle='#fff';
					context.shadowOffsetX=1;
					context.shadowOffsetY=1;
					context.shadowColor='#000000';
					context.strokeRect(drawStruct.left, drawStruct.top, drawStruct.width, drawStruct.height);
					context.shadowOffsetX=0;
					context.shadowOffsetY=0;
				}else{
					context.fillRect(drawStruct.left, drawStruct.top, drawStruct.width, drawStruct.height);
				}
			} else {
				if (drawStruct.mykind == 0) {
					context.strokeStyle='#fff';
					context.shadowOffsetX=1;
					context.shadowOffsetY=1;
					context.shadowColor='#000000';
					context.strokeRect(drawStruct.left, drawStruct.top, drawStruct.width, drawStruct.height);
					context.fillRect(drawStruct.left, drawStruct.top, drawStruct.width, drawStruct.height);
					context.shadowOffsetX=0;
					context.shadowOffsetY=0;
				}else{
					context.fillRect(drawStruct.left-1, drawStruct.top-1, drawStruct.width+2, drawStruct.height);
				}
			}
			context.font = drawStruct.fontSize + "px " + drawStruct.fontName;
			context.textAlign="center";
			context.textBaseline="top";
			context.fillStyle = jsRgb(drawStruct.fontColor);
			textWidth = context.measureText(drawStruct.caption[0]).width;
			if (textWidth * drawStruct.caption.length < drawStruct.width) {
				context.fillText(drawStruct.caption, drawStruct.left + drawStruct.width/2, drawStruct.top);
			} else {
				let tmpI = 0;
				let tmpJ = 0;
				for(i = 0; i < drawStruct.caption.length; i++) {
					if (textWidth * tmpI > drawStruct.width) {
						tmpI = 0;
						tmpJ++;
					}
					if (tmpJ * textWidth > drawStruct.height) {
						break;
					}
					context.fillText(drawStruct.caption[i], drawStruct.left+ textWidth * tmpI, drawStruct.top + textWidth * tmpJ);
					tmpI++;
				}
			}
			break;
		case 6:
			context.fillRect(drawStruct.left-4, drawStruct.top, drawStruct.width, drawStruct.height);
			context.strokeStyle="white";
			context.strokeRect(drawStruct.left-4, drawStruct.top, drawStruct.width, drawStruct.height);
			if (drawStruct.fileName != "") {
				clickXY.push({x: drawStruct.left,y: drawStruct.top,w: drawStruct.width,h: drawStruct.height,f: drawStruct.fileName,c: drawStruct.mpyclass});
			}
			context.fillStyle = jsRgb(drawStruct.fontColor);
			context.font = drawStruct.fontSize+1 + "px " + drawStruct.fontName;
			context.textAlign="center";
			context.textBaseline="middle";
			context.fillText(drawStruct.caption, drawStruct.left+ drawStruct.width/2, drawStruct.top+ drawStruct.height/2);
			break;
		case 7:
			if (drawStruct.dTranparent > 0) {
				context.fillRect(drawStruct.left + drawStruct.height/2, drawStruct.top, drawStruct.width/4, drawStruct.height);
			}
			context.beginPath();
			context.moveTo(drawStruct.left+drawStruct.width/2, drawStruct.top + drawStruct.height/6);
			context.lineTo(drawStruct.left+drawStruct.width*3/4, drawStruct.top + drawStruct.height/2);
			context.lineTo(drawStruct.left+drawStruct.width/2, drawStruct.top + drawStruct.height*5/6);
			context.moveTo(drawStruct.left+drawStruct.width/4, drawStruct.top + drawStruct.height/6);
			context.lineTo(drawStruct.left+drawStruct.width/2, drawStruct.top + drawStruct.height/2);
			context.lineTo(drawStruct.left+drawStruct.width/4, drawStruct.top + drawStruct.height*5/6);
			context.stroke();
			break;
		case 8:
			drawLine(context, drawStruct.left+2, drawStruct.top+2, drawStruct.left+drawStruct.width-2, drawStruct.top+drawStruct.height-2);
			break;
		case 9:
			drawLine(context, drawStruct.left+2, drawStruct.top+drawStruct.height-2, drawStruct.left+drawStruct.width-2, drawStruct.top+2);
			break;
		case 11:
			context.beginPath();
			context.moveTo(drawStruct.left, drawStruct.top+ drawStruct.height);
			context.lineTo(drawStruct.left+ drawStruct.width*13/32, drawStruct.top+ drawStruct.height*19/32);
			context.moveTo(drawStruct.left+ drawStruct.width*3/16, drawStruct.top);
			context.lineTo(drawStruct.left+ drawStruct.width, drawStruct.top+ drawStruct.height*13/16);
			context.moveTo(drawStruct.left, drawStruct.top+ drawStruct.height*3/16);
			context.lineTo(drawStruct.left+ drawStruct.width*13/16, drawStruct.top+ drawStruct.height);
			context.moveTo(drawStruct.left+ drawStruct.width, drawStruct.top);
			context.lineTo(drawStruct.left+ drawStruct.width*19/32, drawStruct.top+ drawStruct.height*13/32);
			context.stroke();
			break;
		case 14:
			context.beginPath();
			context.moveTo(drawStruct.left, drawStruct.top+ drawStruct.height/2);
			context.lineTo(drawStruct.left+ drawStruct.width/2, drawStruct.top+ drawStruct.height/2);
			context.moveTo(drawStruct.left+ drawStruct.width/2, drawStruct.top);
			context.lineTo(drawStruct.left+ drawStruct.width/2, drawStruct.top+ drawStruct.height);
			context.moveTo(drawStruct.left+ drawStruct.width*2/3, drawStruct.top+ drawStruct.height/6);
			context.lineTo(drawStruct.left+ drawStruct.width*2/3, drawStruct.top+ drawStruct.height*5/6);
			context.moveTo(drawStruct.left+ drawStruct.width*5/6, drawStruct.top+ drawStruct.height/3);
			context.lineTo(drawStruct.left+ drawStruct.width*5/6, drawStruct.top+ drawStruct.height*2/3);
			context.stroke();
			break;
		case 15:
			context.fillStyle = jsRgb(drawStruct.fontColor);
			context.font = drawStruct.fontSize+1 + "px " + drawStruct.fontName;
			context.textAlign="center";
			context.fillText("安全运行天数: "+drawStruct.caption+"天", drawStruct.left+ drawStruct.width/2, drawStruct.top+ drawStruct.height/2);
			break;
		case 21:
			context.strokeRect(drawStruct.left+ drawStruct.width/4, drawStruct.top+ drawStruct.height/4, drawStruct.width/2, drawStruct.height/2);
			context.moveTo(drawStruct.left+ drawStruct.width/2, drawStruct.top);
			context.lineTo(drawStruct.left+ drawStruct.width/2, drawStruct.top+ drawStruct.height/3);
			break;
		case 26:
			context.fillRect(drawStruct.left, drawStruct.top, drawStruct.width, drawStruct.height);
			context.beginPath();
			context.moveTo(drawStruct.left+ drawStruct.width*5/6, drawStruct.top+ drawStruct.width/3);
			context.arc(drawStruct.left+ drawStruct.width/2, drawStruct.top+ drawStruct.width/3, drawStruct.width/3,0,Math.PI*2,true);
			context.stroke();
			context.closePath();
			context.beginPath();
			context.strokeStyle=jsRgb(drawStruct.color1);
			context.moveTo(drawStruct.left+ drawStruct.width*2/3, drawStruct.top+ drawStruct.width*2/3);
			context.arc(drawStruct.left+ drawStruct.width/3, drawStruct.top+ drawStruct.width*2/3, drawStruct.width/3,0,Math.PI*2,true);
			context.stroke();
			context.closePath();
			context.beginPath();
			context.strokeStyle=jsRgb(drawStruct.color2);
			context.moveTo(drawStruct.left+ drawStruct.width, drawStruct.top+ drawStruct.width*2/3);
			context.arc(drawStruct.left+ drawStruct.width*2/3, drawStruct.top+ drawStruct.width*2/3, drawStruct.width/3,0,Math.PI*2,true);
			context.stroke();
			context.closePath();
			break;
		case 27:
			context.beginPath();
			context.arc(drawStruct.left+ drawStruct.width/2, drawStruct.top+drawStruct.height/3, drawStruct.width/2-2, 0, Math.PI*2, true);
			context.stroke();
			context.strokeStyle=jsRgb(drawStruct.color1);
			context.beginPath();
			context.arc(drawStruct.left+ drawStruct.width/2, drawStruct.top+drawStruct.height*2/3, drawStruct.width/2-2, 0, Math.PI*2, true);
			context.stroke();
			break;
		case 38:
			drawLine(context, drawStruct.left+(drawStruct.width/2), drawStruct.top, drawStruct.left+drawStruct.width/2, drawStruct.top+drawStruct.height);
			context.strokeRect(drawStruct.left+ drawStruct.width/4, drawStruct.top+ drawStruct.height*3/16, drawStruct.width/2, drawStruct.height*5/8);
			break;
		case 39:
			context.fillRect(drawStruct.left, drawStruct.top, drawStruct.width, drawStruct.height);
			context.beginPath();
			context.moveTo(drawStruct.left+ drawStruct.width/2, drawStruct.top);
			context.lineTo(drawStruct.left+ drawStruct.width/2, drawStruct.top+ drawStruct.height);
			context.stroke();
			context.strokeRect(drawStruct.left+ drawStruct.width*5/16, drawStruct.top+ drawStruct.height*3/16, drawStruct.width*3/8, drawStruct.height*5/8);
			break;
		case 46:
			var faStart=parseInt(drawStruct.caption);
			if (faStart>11) {
				faStart=1;
			}
			switch (faStart) {
				case 0:
					drawLine(context, drawStruct.left+(drawStruct.width/2), drawStruct.top+2, drawStruct.left+2, drawStruct.top+(drawStruct.height-2));
					drawLine(context, drawStruct.left+2, drawStruct.top+(drawStruct.height-2), drawStruct.left+(drawStruct.width-2), drawStruct.top+(drawStruct.height-2));
					drawLine(context, drawStruct.left+(drawStruct.width-2), drawStruct.top+(drawStruct.height-2), drawStruct.left+(drawStruct.width/2), drawStruct.top+2);
					break;
				case 1:
					drawLine(context, drawStruct.left, drawStruct.top+2, drawStruct.left, drawStruct.top+(drawStruct.height-2));
					drawLine(context, drawStruct.left, drawStruct.top+(drawStruct.height-2), drawStruct.left+(drawStruct.width-2), drawStruct.top+(drawStruct.height/2-2));
					drawLine(context, drawStruct.left+(drawStruct.width-4), drawStruct.top+(drawStruct.height/2-2), drawStruct.left, drawStruct.top+2);
					break;
				case 2:
					context.beginPath();
					context.moveTo(drawStruct.left, drawStruct.top);
					context.lineTo(drawStruct.left+drawStruct.width, drawStruct.top);
					context.lineTo(drawStruct.left+drawStruct.width/2, drawStruct.top+drawStruct.height);
					context.closePath();
					context.stroke();
					break;
				case 3:
					drawLine(context, drawStruct.left+2, drawStruct.top+(drawStruct.height/2), drawStruct.left+(drawStruct.width-2), drawStruct.top+2);
					drawLine(context, drawStruct.left+(drawStruct.width-2), drawStruct.top+2, drawStruct.left+(drawStruct.width-2), drawStruct.top+(drawStruct.height-2));
					drawLine(context, drawStruct.left+(drawStruct.width-2), drawStruct.top+(drawStruct.height-2), drawStruct.left+2, drawStruct.top+(drawStruct.height/2));
					break;
				case 4:
					drawLine(context, drawStruct.left+2, drawStruct.top+2, drawStruct.left+(drawStruct.width/2), drawStruct.top+(drawStruct.height/2));
					drawLine(context, drawStruct.left+(drawStruct.width/2), drawStruct.top+(drawStruct.height/2), drawStruct.left+(drawStruct.width-2), drawStruct.top+2);
					drawLine(context, drawStruct.left+(drawStruct.width/2), drawStruct.top+(drawStruct.height/2), drawStruct.left+(drawStruct.width/2), drawStruct.top+(drawStruct.height-2));
					break;
				case 5:
					drawLine(context, drawStruct.left+2, drawStruct.top+(drawStruct.height/2), drawStruct.left+(drawStruct.width/2), drawStruct.top+(drawStruct.height/2));
					drawLine(context, drawStruct.left+(drawStruct.width/2), drawStruct.top+(drawStruct.height/2), drawStruct.left+(drawStruct.width-2), drawStruct.top+2);
					drawLine(context, drawStruct.left+(drawStruct.width/2), drawStruct.top+(drawStruct.height/2), drawStruct.left+(drawStruct.width-2), drawStruct.top+(drawStruct.height-2));
					break;
				case 6:
					drawLine(context, drawStruct.left+(drawStruct.width/2), drawStruct.top+2, drawStruct.left+(drawStruct.width/2), drawStruct.top+(drawStruct.height/2));
					drawLine(context, drawStruct.left+(drawStruct.width/2), drawStruct.top+(drawStruct.height/2), drawStruct.left+2, drawStruct.top+(drawStruct.height-2));
					drawLine(context, drawStruct.left+(drawStruct.width/2), drawStruct.top+(drawStruct.height/2), drawStruct.left+(drawStruct.width-2), drawStruct.top+(drawStruct.height-2));
					break;
				case 7:
					drawLine(context, drawStruct.left+2, drawStruct.top+2, drawStruct.left+(drawStruct.width/2), drawStruct.top+(drawStruct.height/2));
					drawLine(context, drawStruct.left+(drawStruct.width/2), drawStruct.top+(drawStruct.height/2), drawStruct.left+2, drawStruct.top+(drawStruct.height-2));
					drawLine(context, drawStruct.left+(drawStruct.width/2), drawStruct.top+(drawStruct.height/2), drawStruct.left+(drawStruct.width-2), drawStruct.top+(drawStruct.height/2));
					break;
				case 8:
					drawLine(context, drawStruct.left+2, drawStruct.top+2, drawStruct.left+drawStruct.width-2, drawStruct.top+drawStruct.height-2);
					break;
				case 9:
					drawLine(context, drawStruct.left+2, drawStruct.top+drawStruct.height-2, drawStruct.left+ drawStruct.width-2, drawStruct.top+2);
					break;
				case 10:
					drawLine(context, drawStruct.left+2, drawStruct.top+8, drawStruct.left+(drawStruct.width-2), drawStruct.top+8);
					drawLine(context, drawStruct.left+(drawStruct.width-2), drawStruct.top+8, drawStruct.left+(drawStruct.width-2), drawStruct.top+(drawStruct.height+4));
					break;
				case 11:
					context.fillStyle=jsRgb(drawStruct.color);
					context.beginPath();
					context.arc(drawStruct.left+drawStruct.width/2, drawStruct.top+ drawStruct.height/2,Math.min(drawStruct.width, drawStruct.height)/2-2,0,Math.PI*2,true);
					context.stroke();
					break;
				default:
					break;
			}
			break;
		case 50:
			ar= (drawStruct.width-4)/3;
			paramEllipse(context, drawStruct.left+2, drawStruct.top+8, ar, ar);
			context.strokeStyle=jsRgb(drawStruct.color1);
			paramEllipse(context, drawStruct.left+2, drawStruct.top+8+ar, ar, ar);
			context.strokeStyle=jsRgb(drawStruct.color2);
			paramEllipse(context, drawStruct.left+2+ar, drawStruct.top+8+ar/2, ar, ar);
			break;
		case 54:
			context.fillRect(drawStruct.left, drawStruct.top, drawStruct.width, drawStruct.height);
			context.beginPath();
			context.arc(drawStruct.left+ drawStruct.width/2, drawStruct.top+drawStruct.height/3.6,drawStruct.width/2-2,0,Math.PI*2,true);
			context.stroke();
			context.beginPath();
			context.strokeStyle=jsRgb(drawStruct.color1);
			context.arc(drawStruct.left+ drawStruct.width/2, drawStruct.top+drawStruct.height/1.5,drawStruct.width/2-2, 0,Math.PI*2,false);
			context.stroke();
			break;
		case 55:
			paramEllipse(context, drawStruct.left+ drawStruct.width/2-2, drawStruct.top+drawStruct.height/3, drawStruct.width/2-1, drawStruct.height/3-1);
			context.strokeStyle=jsRgb(drawStruct.color1);
			paramEllipse(context, drawStruct.left+ drawStruct.width/2-2, drawStruct.top+drawStruct.height/1.6, drawStruct.width/2-1, drawStruct.height/3-1);
			break;
		case 58:
			context.strokeRect(drawStruct.left, drawStruct.top, drawStruct.width, drawStruct.height);
			context.beginPath();
			for (var i = 0; i < drawStruct.yk1; i++) {
				context.moveTo(drawStruct.left, drawStruct.top + drawStruct.height * i / drawStruct.yk1);
				context.lineTo(drawStruct.left + drawStruct.width, drawStruct.top + drawStruct.height * i / drawStruct.yk1);
			}
			context.stroke();
			if (drawStruct.mykind == 0) {
				context.strokeStyle = "rgb(0,0,0)";
				context.strokeRect(drawStruct.left+1, drawStruct.top+1, drawStruct.width-2, drawStruct.height-2);
				context.beginPath();
				for (var i = 0; i < drawStruct.yk1; i++) {
					context.moveTo(drawStruct.left+1, drawStruct.top+1 + drawStruct.height * i / drawStruct.yk1);
					context.lineTo(drawStruct.left-2 + drawStruct.width, drawStruct.top+1 + drawStruct.height * i / drawStruct.yk1);
				}
				context.stroke();
			}
			break;
		case 59:
			context.beginPath();
			context.moveTo(drawStruct.left, drawStruct.top);
			context.lineTo(drawStruct.left+ drawStruct.width*13/32, drawStruct.top+ drawStruct.height*13/32);
			context.moveTo(drawStruct.left+ drawStruct.width*13/16, drawStruct.top);
			context.lineTo(drawStruct.left, drawStruct.top+ drawStruct.height*13/16);
			context.moveTo(drawStruct.left+ drawStruct.width, drawStruct.top+ drawStruct.height*3/16);
			context.lineTo(drawStruct.left+ drawStruct.width*3/16, drawStruct.top+ drawStruct.height);
			context.moveTo(drawStruct.left+ drawStruct.width, drawStruct.top+ drawStruct.height);
			context.lineTo(drawStruct.left+ drawStruct.width*19/32, drawStruct.top+ drawStruct.height*19/32);
			context.stroke();
			break;
		case 60:
			ar= (drawStruct.width-4)/4;
			context.strokeStyle=jsRgb(drawStruct.color);
			paramEllipse(context, drawStruct.left+16, drawStruct.top+16, drawStruct.width/2, drawStruct.width/2);
			context.strokeStyle=jsRgb(drawStruct.color1);
			paramEllipse(context, drawStruct.left+16, drawStruct.top+16+3*ar, drawStruct.width/2, drawStruct.width/2);
			context.strokeStyle=jsRgb(drawStruct.color2);
			context.beginPath();
			context.moveTo(drawStruct.left+16,drawStruct.top+16+drawStruct.width/2);
			context.lineTo(drawStruct.left+16-drawStruct.width/2, drawStruct.top+16+3*ar);
			context.lineTo(drawStruct.left+16+drawStruct.width/2,drawStruct.top+16+3*ar);
			context.closePath();
			context.stroke();
			break;
		case 69:
			if (drawStruct.dTranparent > 0) {
				context.fillRect(drawStruct.left, drawStruct.top + drawStruct.height/2, drawStruct.width, drawStruct.height/4);
			}
			context.beginPath();
			context.moveTo(drawStruct.left+drawStruct.width/6, drawStruct.top + drawStruct.height/4);
			context.lineTo(drawStruct.left+drawStruct.width/2, drawStruct.top + drawStruct.height/2);
			context.lineTo(drawStruct.left+drawStruct.width*5/6, drawStruct.top + drawStruct.height/4);
			context.moveTo(drawStruct.left+drawStruct.width/6, drawStruct.top + drawStruct.height/2);
			context.lineTo(drawStruct.left+drawStruct.width/2, drawStruct.top + drawStruct.height*3/4);
			context.lineTo(drawStruct.left+drawStruct.width*5/6, drawStruct.top + drawStruct.height/2);
			context.stroke();
			break;
		case 70:
			if (drawStruct.dTranparent > 0) {
				context.fillRect(drawStruct.left, drawStruct.top + drawStruct.height/4, drawStruct.width, drawStruct.height/4);
			}
			context.beginPath();
			context.moveTo(drawStruct.left+drawStruct.width/6, drawStruct.top + drawStruct.height/2);
			context.lineTo(drawStruct.left+drawStruct.width/2, drawStruct.top + drawStruct.height/4);
			context.lineTo(drawStruct.left+drawStruct.width*5/6, drawStruct.top + drawStruct.height/2);
			context.moveTo(drawStruct.left+drawStruct.width/6, drawStruct.top + drawStruct.height*3/4);
			context.lineTo(drawStruct.left+drawStruct.width/2, drawStruct.top + drawStruct.height/2);
			context.lineTo(drawStruct.left+drawStruct.width*5/6, drawStruct.top + drawStruct.height*3/4);
			context.stroke();
			break;
		case 73:
			context.fillRect(drawStruct.left, drawStruct.top, drawStruct.width, drawStruct.height);
			context.beginPath();
			context.moveTo(drawStruct.left+drawStruct.width/2, drawStruct.top);
			context.lineTo(drawStruct.left+drawStruct.width/2, drawStruct.top+ drawStruct.height/3);
			context.moveTo(drawStruct.left, drawStruct.top+drawStruct.height/3);
			context.lineTo(drawStruct.left+drawStruct.width, drawStruct.top+drawStruct.height/3);
			context.moveTo(drawStruct.left, drawStruct.top+drawStruct.height*2/3);
			context.lineTo(drawStruct.left+drawStruct.width, drawStruct.top+drawStruct.height*2/3);
			context.moveTo(drawStruct.left+drawStruct.width/2, drawStruct.top+ drawStruct.height*2/3);
			context.lineTo(drawStruct.left+drawStruct.width/2, drawStruct.top+drawStruct.height);
			context.stroke();
			break;
		case 77:
			context.beginPath();
			context.moveTo(drawStruct.left, drawStruct.top+drawStruct.height/2);
			context.lineTo(drawStruct.left+ drawStruct.width/3, drawStruct.top+ drawStruct.height/2);
			context.moveTo(drawStruct.left+ drawStruct.width/3, drawStruct.top);
			context.lineTo(drawStruct.left+ drawStruct.width/3, drawStruct.top+ drawStruct.height);
			context.moveTo(drawStruct.left+ drawStruct.width*2/3, drawStruct.top);
			context.lineTo(drawStruct.left+ drawStruct.width*2/3, drawStruct.top+ drawStruct.height);
			context.moveTo(drawStruct.left+ drawStruct.width, drawStruct.top+ drawStruct.height/2);
			context.lineTo(drawStruct.left+ drawStruct.width*2/3, drawStruct.top+ drawStruct.height/2);
			context.stroke();
			break;
		case 80:
		case 104:
			drawLine(context, drawStruct.left+drawStruct.width/2, drawStruct.top, drawStruct.left+drawStruct.width/2, drawStruct.top+drawStruct.height/2);
			drawLine(context, drawStruct.left+drawStruct.width/8, drawStruct.top+drawStruct.height/2, drawStruct.left+7*drawStruct.width/8, drawStruct.top+drawStruct.height/2);
			drawLine(context, drawStruct.left+drawStruct.width/4, drawStruct.top+2*drawStruct.height/3, drawStruct.left+3*drawStruct.width/4, drawStruct.top+2*drawStruct.height/3);
			drawLine(context, drawStruct.left+3*drawStruct.width/8, drawStruct.top+5*drawStruct.height/6, drawStruct.left+5*drawStruct.width/8, drawStruct.top+5*drawStruct.height/6);
			break;
		case 81:
			context.fillRect(drawStruct.left, drawStruct.top, drawStruct.width, drawStruct.height);
			drawLine(context, drawStruct.left+5, drawStruct.top+drawStruct.height/2-2, drawStruct.left+drawStruct.width/2+5, drawStruct.top+drawStruct.height/2-2);
			drawLine(context, drawStruct.left+drawStruct.width/2-4, drawStruct.top+drawStruct.height/7-4, drawStruct.left+drawStruct.width/2-4, drawStruct.top+drawStruct.height*6/7-4);
			drawLine(context, drawStruct.left+drawStruct.width/3-4, drawStruct.top+drawStruct.height*2/7-4, drawStruct.left+drawStruct.width/3-4, drawStruct.top+drawStruct.height*5/7-4);
			drawLine(context, drawStruct.left+drawStruct.width/6-4, drawStruct.top+drawStruct.height*3/7-4, drawStruct.left+drawStruct.width/6-4, drawStruct.top+drawStruct.height*4/7-4);
			break;
		case 83:
		case 86:
		case 184:
		case 201:
			context.fillRect(drawStruct.left, drawStruct.top, drawStruct.width, drawStruct.height);
			if (drawStruct.fileName != "") {
				clickXY.push({x: drawStruct.left,y: drawStruct.top,w: drawStruct.width,h: drawStruct.height,f: station+'/'+drawStruct.fileName,c: drawStruct.mpyclass});
			}
			context.fillStyle = jsRgb(drawStruct.fontColor);
			context.font = drawStruct.fontSize+1 + "px " + drawStruct.fontName;
			context.textAlign="center";
			context.textBaseline="middle";
			context.fillText(drawStruct.caption, drawStruct.left+ drawStruct.width/2, drawStruct.top+ drawStruct.height/2);
			break;
		case 92:
			drawLine(context, drawStruct.left+3*drawStruct.width/8, drawStruct.top+drawStruct.height/6, drawStruct.left+5*drawStruct.width/8, drawStruct.top+drawStruct.height/6);
			drawLine(context, drawStruct.left+drawStruct.width/4, drawStruct.top+drawStruct.height/3, drawStruct.left+3*drawStruct.width/4, drawStruct.top+drawStruct.height/3);
			drawLine(context, drawStruct.left+drawStruct.width/8, drawStruct.top+drawStruct.height/2, drawStruct.left+7*drawStruct.width/8, drawStruct.top+drawStruct.height/2);
			drawLine(context, drawStruct.left+drawStruct.width/2, drawStruct.top + drawStruct.height, drawStruct.left+drawStruct.width/2, drawStruct.top+drawStruct.height/2);
			break;
		case 94:
			context.beginPath();
			context.moveTo(drawStruct.left+drawStruct.width/6, drawStruct.top+drawStruct.height/3);
			context.lineTo(drawStruct.left+drawStruct.width/6, drawStruct.top+drawStruct.height*2/3);
			context.moveTo(drawStruct.left+drawStruct.width/3, drawStruct.top+drawStruct.height/6);
			context.lineTo(drawStruct.left+drawStruct.width/3, drawStruct.top+drawStruct.height*5/6);
			context.moveTo(drawStruct.left+drawStruct.width/2, drawStruct.top);
			context.lineTo(drawStruct.left+drawStruct.width/2, drawStruct.top+drawStruct.height);
			context.moveTo(drawStruct.left+drawStruct.width/2, drawStruct.top+drawStruct.height/2);
			context.lineTo(drawStruct.left+drawStruct.width, drawStruct.top+drawStruct.height/2);
			context.stroke();
			break;
		case 95:
			context.fillRect(drawStruct.left, drawStruct.top, drawStruct.width, drawStruct.height);
			context.beginPath();
			context.moveTo(drawStruct.left-5, drawStruct.top+ drawStruct.height/2);
			context.lineTo(drawStruct.left+ drawStruct.width, drawStruct.top+ drawStruct.height/2);
			context.stroke();
			context.strokeRect(drawStruct.left+ drawStruct.width/8, drawStruct.top+ drawStruct.height*5/16, drawStruct.width*3/4, drawStruct.height*3/8);
			break;
		case 96:
			if (drawStruct.fileName != "") {
				clickXY.push({x: drawStruct.left,y: drawStruct.top,w: drawStruct.width,h: drawStruct.height,f: drawStruct.fileName,c: drawStruct.mpyclass});
			}
			context.fillStyle = jsRgb(drawStruct.fontColor);
			context.font = drawStruct.fontSize + "px " + drawStruct.fontName;
			context.textAlign = "left";
			context.textBaseline = "top";
			var str = drawStruct.caption;
			var lineWidth = 0;
			var canvasWidth = drawStruct.width;// 计算canvas的宽度
			var initHeight=0;// 绘制字体距离canvas顶部初始的高度
			var lastSubStrIndex= 0; // 每次开始截取的字符串的索引
			for(let i=0;i<str.length;i++){
				lineWidth += context.measureText(str[i]).width;
				if(lineWidth > canvasWidth){
					context.fillText(str.substring(lastSubStrIndex,i),drawStruct.left+8,drawStruct.top+initHeight);// 绘制截取部分
					initHeight+=20;// 20为字体的高度
					lineWidth = context.measureText(str[i]).width;
					lastSubStrIndex=i;
				}
				if(i==str.length-1){// 绘制剩余部分
					context.fillText(str.substring(lastSubStrIndex,i+1),drawStruct.left+8,drawStruct.top+initHeight);
				}
			}
			break;
		case 98:
			context.moveTo(drawStruct.left+drawStruct.width, drawStruct.top+drawStruct.height/2);
			context.arc(drawStruct.left+drawStruct.width/2, drawStruct.top+drawStruct.height/2, drawStruct.width/2, 0, Math.PI*2, true);
			context.arc(drawStruct.left+drawStruct.width*3/4, drawStruct.top+drawStruct.height/2, drawStruct.width/4, 0, Math.PI, false);
			context.arc(drawStruct.left+drawStruct.width/4, drawStruct.top+drawStruct.height/2, drawStruct.width/4, 0, Math.PI, true);
			context.stroke();
			break;
		case 105:
			if (drawStruct.dTranparent > 0) {
				context.fillRect(drawStruct.left + drawStruct.width/4, drawStruct.top, drawStruct.width/4, drawStruct.height);
			}
			context.beginPath();
			context.moveTo(drawStruct.left+drawStruct.width/2, drawStruct.top + drawStruct.height/6);
			context.lineTo(drawStruct.left+drawStruct.width/4, drawStruct.top + drawStruct.height/2);
			context.lineTo(drawStruct.left+drawStruct.width/2, drawStruct.top + drawStruct.height*5/6);
			context.moveTo(drawStruct.left+drawStruct.width*3/4, drawStruct.top + drawStruct.height/6);
			context.lineTo(drawStruct.left+drawStruct.width/2, drawStruct.top + drawStruct.height/2);
			context.lineTo(drawStruct.left+drawStruct.width*3/4, drawStruct.top + drawStruct.height*5/6);
			context.stroke();
			break ;
		case 106:
            context.clearRect(drawStruct.left, drawStruct.top, drawStruct.width, drawStruct.height);
			context.font= (drawStruct.fontSize+1)+"px "+ drawStruct.fontName;
			context.textAlign="left";
			context.fillStyle= jsRgb(drawStruct.fontColor);
			context.fillText(drawStruct.checkA1 + drawStruct.checkM1 + drawStruct.checkB1, drawStruct.left+ drawStruct.width/5, drawStruct.top+ drawStruct.height/3);
			context.fillStyle= jsRgb(drawStruct.color1);
			context.fillText(drawStruct.checkA2 + drawStruct.checkM2 + drawStruct.checkB2, drawStruct.left+ drawStruct.width/5, drawStruct.top+ 2*drawStruct.height/3);
			context.fillStyle= jsRgb(drawStruct.color2);
			context.fillText(drawStruct.checkA3 + drawStruct.checkC1 + drawStruct.checkB3, drawStruct.left+ drawStruct.width/5, drawStruct.top+ drawStruct.height);
			break;
		case 107:
			if (drawStruct.penWidth==1) {
				context.setLineDash([5,10]);
				context.beginPath();
				context.moveTo(drawStruct.left,drawStruct.top+4);
				context.lineTo(drawStruct.left+drawStruct.width,drawStruct.top+4);
				context.stroke();
				context.setLineDash([]);
			} else {
				context.beginPath();
				context.moveTo(drawStruct.left,drawStruct.top+4);
				context.lineTo(drawStruct.left+drawStruct.width,drawStruct.top+4);
				context.stroke();
			}
			break;
		case 108:
			if (drawStruct.penWidth==1) {
				context.setLineDash([5,10]);
				context.beginPath();
				context.moveTo(drawStruct.left+4,drawStruct.top);
				context.lineTo(drawStruct.left+4,drawStruct.top+drawStruct.height);
				context.stroke();
				context.setLineDash([]);
			} else {
				context.beginPath();
				context.moveTo(drawStruct.left+4,drawStruct.top);
				context.lineTo(drawStruct.left+4,drawStruct.top+drawStruct.height);
				context.stroke();
			}
			break;
		case 112:
		case 181:
			if (drawStruct.dTranparent == 1) {
				context.fillRect(drawStruct.left, drawStruct.top, drawStruct.width, drawStruct.height);
			}
			context.fillStyle = jsRgb(drawStruct.fontColor);
			context.font = (drawStruct.fontSize+1) + "px " + drawStruct.fontName;
			context.textAlign="center";
			context.textBaseline="top";
			textWidth = context.measureText(drawStruct.caption[0]).width;
			if (textWidth * drawStruct.caption.length < drawStruct.width) {
				context.fillText(drawStruct.caption, drawStruct.left + drawStruct.width/2, drawStruct.top);
			} else {
				let tmpI = 0;
				let tmpJ = 0;
				for(i = 0; i < drawStruct.caption.length; i++) {
					if (textWidth * tmpI > drawStruct.width) {
						tmpI = 0;
						tmpJ++;
					}
					if (tmpJ * textWidth > drawStruct.height) {
						break;
					}
					context.fillText(drawStruct.caption[i], drawStruct.left+ textWidth * tmpI, drawStruct.top + textWidth * tmpJ);
					tmpI++;
				}
			}
			break;
		case 114:
			var temp;
			if (drawStruct.mpyBtStart> drawStruct.mpyBtEnd) {
				temp= drawStruct.mpyBtEnd;
				drawStruct.mpyBtEnd= drawStruct.mpyBtStart;
				drawStruct.mpyBtStart= temp;
			}
			if (drawStruct.mpyBtEnd==0) {
				drawStruct.mpyBtEnd=1;
			}
			if (drawStruct.mpyBtStart== drawStruct.mpyBtEnd) {
				drawStruct.mpyBtEnd= drawStruct.mpyBtStart+1;
			}
			if (drawStruct.mpyBtStart>0) {
				temp= drawStruct.mpyBtMiddle/ drawStruct.mpyBtEnd*100;
			} else {
				temp= drawStruct.mpyBtMiddle/(drawStruct.mpyBtEnd- drawStruct.mpyBtStart)*100;
			}
			if (temp>100) {
				temp=100;
			} else {
				temp=Math.abs(temp);
			}
			var n= drawStruct.height*2/9;
			var b= drawStruct.width/2;
			var d= parseInt(n/100*(100-temp));
			context.strokeStyle= jsRgb(drawStruct.color);
			var c;
			context.beginPath();
			for (var i = 0; i < n; i++) {
				if (i==d) {
					context.strokeStyle=jsRgb(drawStruct.color);
				}
				c=3*i+2;
				context.moveTo(drawStruct.left+b-1, drawStruct.top+c);
				context.lineTo(drawStruct.left+4, drawStruct.top+c);
				context.moveTo(drawStruct.left+b+1, drawStruct.top+c);
				context.lineTo(drawStruct.left+ drawStruct.width-5, drawStruct.top+c);
				c+=1;
				context.moveTo(drawStruct.left+b+1, drawStruct.top+c);
				context.lineTo(drawStruct.left+ drawStruct.width-5, drawStruct.top+c);
				context.moveTo(drawStruct.left+b-1, drawStruct.top+c);
				context.lineTo(drawStruct.left+4, drawStruct.top+c);
			}
			context.closePath();
			context.stroke();
			context.font= (drawStruct.fontSize+1)+"px "+ drawStruct.fontName;
			context.fillStyle= jsRgb(drawStruct.fontColor);
			context.textAlign="center";
			context.textBaseline="top";
			context.fillText(drawStruct.caption,  drawStruct.left+ drawStruct.width/2, drawStruct.top+ drawStruct.height*3/4);
			break;
		case 115:
			ar= drawStruct.width;
			switch (drawStruct.yk2) {
				case 0:
					context.lineWidth = 1;
					drawLine(context, drawStruct.left+ drawStruct.width/2, drawStruct.top, drawStruct.left+ drawStruct.width/2, drawStruct.top+ drawStruct.height);
					context.fillStyle = jsRgb(drawStruct.color);
					context.beginPath();
					context.moveTo(drawStruct.left+ drawStruct.width/2, drawStruct.top+ drawStruct.height);
					context.lineTo(drawStruct.left, drawStruct.top+ drawStruct.height - drawStruct.width/2);
					context.lineTo(drawStruct.left+ drawStruct.width , drawStruct.top+ drawStruct.height -drawStruct.width/2);
					context.fill();
					break;
				case 1:
					drawLine(context, drawStruct.left+ drawStruct.width/2, drawStruct.top, drawStruct.left+ drawStruct.width/2, drawStruct.top+ drawStruct.height);
					context.fillStyle = jsRgb(drawStruct.color);
					context.beginPath();
					context.moveTo(drawStruct.left+ drawStruct.width/2, drawStruct.top);
					context.lineTo(drawStruct.left, drawStruct.top+ drawStruct.width/2);
					context.lineTo(drawStruct.left+ drawStruct.width, drawStruct.top+ drawStruct.width/2);
					context.fill();
					break;
				case 2:
					drawLine(context, drawStruct.left, drawStruct.top+drawStruct.height/2, drawStruct.left+ drawStruct.width, drawStruct.top+ drawStruct.height/2);
					context.fillStyle = jsRgb(drawStruct.color);
					context.beginPath();
					context.moveTo(drawStruct.left+ drawStruct.width, drawStruct.top+drawStruct.height/2);
					context.lineTo(drawStruct.left+ drawStruct.width-drawStruct.height/2 , drawStruct.top);
					context.lineTo(drawStruct.left+ drawStruct.width-drawStruct.height/2 , drawStruct.top+drawStruct.height);
					context.fill();
					break;
				case 3:
					drawLine(context, drawStruct.left, drawStruct.top+drawStruct.height/2, drawStruct.left+ drawStruct.width, drawStruct.top+ drawStruct.height/2);
					context.fillStyle = jsRgb(drawStruct.color);
					context.beginPath();
					context.moveTo(drawStruct.left, drawStruct.top+drawStruct.height/2);
					context.lineTo(drawStruct.left+drawStruct.height/2 , drawStruct.top);
					context.lineTo(drawStruct.left+drawStruct.height/2 , drawStruct.top+drawStruct.height);
					context.fill();
					break;
				default:
					break;
			}
			break;
		case 119:
			// var img = new Image();
			// img.onload = function(){
			// 	context.drawImage(img, drawStruct.left, drawStruct.top, drawStruct.width, drawStruct.height);
			// }
			// img.src = "/profile/zhfh/001颜色-1.bmp";
			var src= api.url+"/profile/zhfh/001颜色-1.bmp";// 设置图片源地址
			wx.downloadFile({
				url: src,
				success: (res) => {
					let img = res.tempFilePath;
					context.drawImage(img, drawStruct.left, drawStruct.top, drawStruct.width, drawStruct.height);
				}
			})
			break;
		case 122:
			// var img = new Image();
			// img.onload = function(){
			// 	context.drawImage(img, drawStruct.left, drawStruct.top, drawStruct.width, drawStruct.height);
			// }
			// img.src = "/profile/zhfh/001颜色-1.bmp";
			var src= api.url+"/profile/zhfh/001颜色-1.bmp";// 设置图片源地址
			wx.downloadFile({
				url: src,
				success: (res) => {
					let img = res.tempFilePath;
					context.drawImage(img, drawStruct.left, drawStruct.top, drawStruct.width, drawStruct.height);
				}
			})
			break;
		case 124:
			context.fillStyle = jsRgb(drawStruct.color1);
			context.fillRect(drawStruct.left, drawStruct.top, drawStruct.width, drawStruct.height);
			if (drawStruct.fileName != "") {
				clickXY.push({
					x: drawStruct.left,
					y: drawStruct.top,
					w: drawStruct.width,
					h: drawStruct.height,
					f:  drawStruct.fileName,
					c: drawStruct.mpyclass
				});
			}
			context.fillStyle = jsRgb(drawStruct.fontColor);
			context.font = drawStruct.fontSize + "px " + drawStruct.fontName;
			context.textAlign="center";
			context.textBaseline="middle";
			context.fillText(drawStruct.caption,  drawStruct.left+ drawStruct.width/2, drawStruct.top+ drawStruct.height/2);
			break;
		case 127:
			var temp = new Date().format('hh:mm:ss');
			context.fillStyle = jsRgb(drawStruct.bkColor);
			context.fillStyle = jsRgb(drawStruct.fontColor);
			context.font = drawStruct.fontSize + "px " + drawStruct.fontName;
			context.textAlign="center";
			context.fillText(temp, drawStruct.left+ drawStruct.width/2, drawStruct.top+ drawStruct.height/2);
			break;
		case 128:
			var temp = new Date().format('yyyy年MM月dd日');
			context.fillStyle = jsRgb(drawStruct.fontColor);
			context.font = drawStruct.fontSize + "px " + drawStruct.fontName;
			context.textAlign="center";
			context.fillText(temp, drawStruct.left+ drawStruct.width/2.2, drawStruct.top+ drawStruct.height/2);
			break;
		case 132:
			if (drawStruct.dTranparent==0) {
				context.shadowOffsetY=1;
				context.beginPath();
				context.moveTo(drawStruct.left,drawStruct.top+4);
				context.lineTo(drawStruct.left+drawStruct.width,drawStruct.top+4);
				context.stroke();
				context.shadowOffsetY=0;
			} else {
				context.beginPath();
				context.moveTo(drawStruct.left,drawStruct.top+4);
				context.lineTo(drawStruct.left+drawStruct.width,drawStruct.top+4);
				context.stroke();
			}
			break;
		case 133:
			if (drawStruct.penWidth==0) {
				context.shadowOffsetX=1;
				context.beginPath();
				context.moveTo(drawStruct.left+4,drawStruct.top);
				context.lineTo(drawStruct.left+4,drawStruct.top+drawStruct.height);
				context.stroke();
				context.shadowOffsetX=0;
			} else {
				context.beginPath();
				context.moveTo(drawStruct.left+4,drawStruct.top);
				context.lineTo(drawStruct.left+4,drawStruct.top+drawStruct.height);
				context.stroke();
			}
			break;
		case 175:
			context.fillRect(drawStruct.left, drawStruct.top, drawStruct.width, drawStruct.height);
			context.font="18px 黑体";
			context.textBaseline = "top";
			context.fillStyle="white";
			context.fillText(drawStruct.caption, drawStruct.left+ drawStruct.width/2, drawStruct.top+3);
			context.fillStyle="black";
			context.fillText(drawStruct.caption, drawStruct.left+ drawStruct.width/2+1, drawStruct.top+5);
			var cdhs=[drawStruct.xuHao, drawStruct.yk1, drawStruct.yk2, drawStruct.lintInt1, drawStruct.lintInt2, drawStruct.lintInt3, drawStruct.lintInt4];
			var arrayPos=-1;
			if (drawStruct.xuHao>=0) {
				arrayPos=0;
			}
			context.font= (drawStruct.fontSize+1)+"px "+ drawStruct.fontName;
			for (var i = 0; i < 25; i++) {
				context.fillStyle='green';
				context.moveTo(drawStruct.left+50+((drawStruct.width-60)/24)*i, drawStruct.top+drawStruct.height-51);
				context.lineTo(drawStruct.left+50+((drawStruct.width-60)/24)*i, drawStruct.top+30);
				context.fillStyle='white';
				context.fillText(i,drawStruct.left+50+((drawStruct.width-60)/24)*i-5,  drawStruct.top+drawStruct.height-37);
			}
			for(var i= drawStruct.height-50;i>10;i-=20){
				context.fillStyle='green';
				context.moveTo(drawStruct.left+50, drawStruct.top+i);
				context.lineTo(drawStruct.left+ drawStruct.width-10, drawStruct.top+i);
			}
			context.stroke();
			$.post("curveByCdhs",{"cdhs":cdhs},function(data,status){
				if (status) {
					var unit=20*(data.max-data.min)/(drawStruct.height-80);
					var jsum=0;
					for(var i= drawStruct.height-50;i>10;i-=20){
						context.fillStyle='white';
						context.textAlign="right";
						context.fillText((data.min+unit*jsum).toFixed(2),drawStruct.left+45, drawStruct.top-8+i);
						jsum++;
					}
					for (var i = 0; i < Object.keys(data).length; i++) {
						if (i==0) {
							context.strokeStyle="red";
						} else if (i==1) {
							context.strokeStyle="yellow";
						}else if (i==2) {
							context.strokeStyle="white";
						}else if (i==3) {
							context.strokeStyle="green";
						}else if (i==4) {
							context.strokeStyle="rgb(176,176,255)";
						}
						var item="m"+i;
						if (data[item]==null) {
							continue;
						}
						context.lineWidth= drawStruct.penWidth;
						context.beginPath();
						context.moveTo(drawStruct.left+50,drawStruct.top+ drawStruct.height-50-20*(data[item][0]-data.min)/unit);
						for (var j = 0; j < data[item].length; j++) {
							context.lineTo(drawStruct.left+50+j*(drawStruct.width-60)/288,drawStruct.top+ drawStruct.height-50-20*(data[item][j]-data.min)/unit);
						}
						context.stroke();
					}
				} else {
					alert("获取数据失败!");
				}
			});
			break;
		case 186:
			context.strokeStyle=jsRgb(drawStruct.color2);
			context.beginPath();
			context.moveTo(drawStruct.left+ drawStruct.width, drawStruct.top);
			context.lineTo(drawStruct.left+ drawStruct.width/3, drawStruct.top+ drawStruct.width*2/3);
			context.lineTo(drawStruct.left+ drawStruct.width/3, drawStruct.top+ drawStruct.height);
			context.moveTo(drawStruct.left+ drawStruct.width/3, drawStruct.top+ drawStruct.width/3);
			context.lineTo(drawStruct.left+ drawStruct.width*2/3, drawStruct.top);
			context.lineTo(drawStruct.left+ drawStruct.width, drawStruct.top+ drawStruct.width/3);
			context.lineTo(drawStruct.left+ drawStruct.width*2/3, drawStruct.top+ drawStruct.width*2/3);
			context.closePath();
			context.stroke();
			break;
		case 188:
			context.font = drawStruct.fontSize + "px " + drawStruct.fontName;
			var step;
			if (drawStruct.by>0) {
				step= (drawStruct.height-2)/ drawStruct.by;
			}
			if (drawStruct.checkMS2=="遥测日期或时间" || drawStruct.checkMS2=="遥脉日期或时间") {
				var dateTime;
				if (drawStruct.checkMC1=="日报") {
					if (drawStruct.checkMS2=="遥测日期或时间"){
						dateTime= [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,"日最大值","日最小值","日平均值","日最大值时间","日最小值时间"];
					}else {
						dateTime= [0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,"日累计电量"];
					}
				} else if (drawStruct.checkMC1=="月报") {
					dateTime= new Date().format('yyyy年MM月');
				}else {
					dateTime= new Date().format('yyyy年');
				}
				context.beginPath();
				if (drawStruct.lintInt1<1) {
					drawStruct.lintInt1=1;
				}
				context.lineWidth= drawStruct.lintInt1;
				context.moveTo(drawStruct.left+1, drawStruct.top+1);
				context.lineTo(drawStruct.left+1, drawStruct.top+ drawStruct.height+1);
				if (drawStruct.lintInt4<1) {
					drawStruct.lintInt4=1;
				}
				context.lineWidth= drawStruct.lintInt4;
				context.moveTo(drawStruct.left+ drawStruct.width, drawStruct.top+1);
				context.lineTo(drawStruct.left+ drawStruct.width, drawStruct.top+ drawStruct.height+1);
				for (var i = 0; i <= drawStruct.by; i++) {
					context.moveTo(drawStruct.left, drawStruct.top+ step*i);
					context.lineTo(drawStruct.left+ drawStruct.width, drawStruct.top+ step*i);
					context.font= (drawStruct.fontSize+1)+"px "+ drawStruct.fontName;
					context.fillStyle= jsRgb(drawStruct.fontColor);
					context.textAlign = "center";
					context.textBaseline="middle";
					if (i<dateTime.length) {
						context.fillText(dateTime[i], drawStruct.left+ drawStruct.width/2, drawStruct.top+step*(i+0.5));
					}
				}
				context.closePath();
				context.stroke();
			}else if (drawStruct.checkMS2=="显示日期") {
				context.fillRect(drawStruct.left+1, drawStruct.top+1, drawStruct.width, drawStruct.height);
				var dateTime;
				if (drawStruct.checkMC1=="日报") {
					dateTime = new Date().format('yyyy年MM月dd日');
				} else if (drawStruct.checkMC1=="月报") {
					dateTime = new Date().format('yyyy年MM月');
				}else {
					dateTime = new Date().format('yyyy年MM月');
				}
				context.font= (drawStruct.fontSize+1)+"px "+ drawStruct.fontName;
				context.fillStyle= jsRgb(drawStruct.fontColor);
				context.textAlign="center";
				context.fillText(dateTime,  drawStruct.left+ drawStruct.width/2, drawStruct.top+ drawStruct.height/2);
			}else if (drawStruct.checkMS2=="只画边框标题") {
				context.fillRect(drawStruct.left+1, drawStruct.top+1, drawStruct.width, drawStruct.height);
				context.beginPath();
				if (drawStruct.lintInt1<1) {
					drawStruct.lintInt1=1;
				}
				context.lineWidth= drawStruct.lintInt1;
				context.moveTo(drawStruct.left+1, drawStruct.top+1);
				context.lineTo(drawStruct.left+1, drawStruct.top+ drawStruct.height+1);
				if (drawStruct.lintInt2<1) {
					drawStruct.lintInt2=1;
				}
				context.lineWidth= drawStruct.lintInt2;
				context.moveTo(drawStruct.left+1, drawStruct.top+1);
				context.lineTo(drawStruct.left+ drawStruct.width+1, drawStruct.top+ 1);
				if (drawStruct.lintInt3<1) {
					drawStruct.lintInt3=1;
				}
				context.lineWidth= drawStruct.lintInt3;
				context.moveTo(drawStruct.left+1, drawStruct.top+ drawStruct.height);
				context.lineTo(drawStruct.left+ drawStruct.width+1, drawStruct.top+ drawStruct.height);
				if (drawStruct.lintInt4<1) {
					drawStruct.lintInt4=1;
				}
				context.lineWidth= drawStruct.lintInt4;
				context.moveTo(drawStruct.left+ drawStruct.width, drawStruct.top+1);
				context.lineTo(drawStruct.left+ drawStruct.width, drawStruct.top+ drawStruct.height+1);
				context.closePath();
				context.stroke();
				context.font= (drawStruct.fontSize+1)+"px "+ drawStruct.fontName;
				context.fillStyle= jsRgb(drawStruct.fontColor);
				var text = context.measureText(drawStruct.caption);
				context.textAlign = "center";
				context.fillText(drawStruct.caption, drawStruct.left+ drawStruct.width/2, drawStruct.top+ drawStruct.height/2);
			}else if (drawStruct.checkMS2=="遥测") {
				context.beginPath();
				if (drawStruct.lintInt1<1) {
					drawStruct.lintInt1=1;
				}
				context.lineWidth= drawStruct.lintInt1;
				context.moveTo(drawStruct.left+1, drawStruct.top+1);
				context.lineTo(drawStruct.left+1, drawStruct.top+ drawStruct.height+1);
				if (drawStruct.lintInt4<1) {
					drawStruct.lintInt4=1;
				}
				context.lineWidth= drawStruct.lintInt4;
				context.moveTo(drawStruct.left+ drawStruct.width, drawStruct.top+1);
				context.lineTo(drawStruct.left+ drawStruct.width, drawStruct.top+ drawStruct.height+1);
				for (var i = 0; i <= drawStruct.by; i++) {
					context.moveTo(drawStruct.left, drawStruct.top+ step*i);
					context.lineTo(drawStruct.left+ drawStruct.width, drawStruct.top+ step*i);
				}
				context.closePath();
				context.stroke();
				$.post("ycByCdh", {cdh:drawStruct.xuHao}, function(data,status){
					if (status) {
						context.fillStyle= jsRgb(drawStruct.fontColor);
						context.textAlign = "center";
						context.textBaseline="middle";
						var i=0;
						for (j = 0; j < data.length;i++, j++) {
							if (j<data.length-2) {
								context.fillText(data[j], drawStruct.left+ drawStruct.width/2, drawStruct.top+step*(i+0.5))
							}else{
								context.fillText(Math.round(data[j]/12)+":"+Math.round(data[j]%12), drawStruct.left+ drawStruct.width/2, drawStruct.top+step*(i+0.5))
							}
						}
					} else {
						alert("获取数据失败!");
					}
				});
			}else if (drawStruct.checkMS2=="遥脉") {
				context.beginPath();
				if (drawStruct.lintInt1<1) {
					drawStruct.lintInt1=1;
				}
				context.lineWidth= drawStruct.lintInt1;
				context.moveTo(drawStruct.left+1, drawStruct.top+1);
				context.lineTo(drawStruct.left+1, drawStruct.top+ drawStruct.height+1);
				if (drawStruct.lintInt4<1) {
					drawStruct.lintInt4=1;
				}
				context.lineWidth= drawStruct.lintInt4;
				context.moveTo(drawStruct.left+ drawStruct.width, drawStruct.top+1);
				context.lineTo(drawStruct.left+ drawStruct.width, drawStruct.top+ drawStruct.height+1);
				for (var i = 0; i <= drawStruct.by; i++) {
					context.moveTo(drawStruct.left, drawStruct.top+ step*i);
					context.lineTo(drawStruct.left+ drawStruct.width, drawStruct.top+ step*i);
				}
				context.closePath();
				context.stroke();
				$.post("ymByCdh", {"cdh":drawStruct.xuHao},	function(data,status){
					if (status) {
						context.fillStyle= jsRgb(drawStruct.fontColor);
						context.textAlign = "center";
						context.textBaseline="middle";
						var i=0;
						for (j = 0; j < data.length;i++, j++) {
							context.fillText(data[j], drawStruct.left+ drawStruct.width/2, drawStruct.top+step*(i+0.5));
						}
					} else {
						alert("获取数据失败!");
					}
				});
			}else{
				var tempS;
				var queryTime;
				if (drawStruct.checkMC1=="日报") {
					queryTime= drawStruct.checkMS1.substr(0,10);
				} else if (drawStruct.checkMC1=="月报") {
					queryTime= drawStruct.checkMS1.substr(0,7);
				}
				context.beginPath();
				if (drawStruct.lintInt1<1) {
					drawStruct.lintInt1=1;
				}
				context.lineWidth= drawStruct.lintInt1;
				context.moveTo(drawStruct.left+1, drawStruct.top+1);
				context.lineTo(drawStruct.left+1, drawStruct.top+ drawStruct.height+1);
				if (drawStruct.lintInt4<1) {
					drawStruct.lintInt4=1;
				}
				context.lineWidth= drawStruct.lintInt4;
				context.moveTo(drawStruct.left+ drawStruct.width, drawStruct.top+1);
				context.lineTo(drawStruct.left+ drawStruct.width, drawStruct.top+ drawStruct.height+1);
				for (var i = 0; i <= drawStruct.by; i++) {
					context.moveTo(drawStruct.left, drawStruct.top+ step*i);
					context.lineTo(drawStruct.left+ drawStruct.width, drawStruct.top+ step*i);
					context.fillStyle= jsRgb(drawStruct.fontColor);
					context.textAlign = "center";
					context.fillText(tempS, drawStruct.left+ drawStruct.width/2, drawStruct.top+ drawStruct.height/2);
				}
				context.closePath();
				context.stroke();
			}
			break;
		case 189:
			roundedRect(context, drawStruct.left, drawStruct.top, drawStruct.width, drawStruct.height,5);
			context.fillStyle = jsRgb(drawStruct.fontColor);
			context.font = (drawStruct.fontSize+1) + "px " + drawStruct.fontName;
			context.textAlign="center";
			context.textBaseline="middle";
			context.fillText(drawStruct.caption, drawStruct.left+ drawStruct.width/2, drawStruct.top+ drawStruct.height/2)
			clickXY.push({x: drawStruct.left,y: drawStruct.top,w: drawStruct.width,h: drawStruct.height,f: drawStruct.fileName,c: drawStruct.mpyclass});
			break;
		case 192:
			var radius=Math.min(drawStruct.width, drawStruct.height);
			switch(drawStruct.yk2) {
				case 0:
					context.moveTo(drawStruct.left+drawStruct.width/2, drawStruct.top+drawStruct.height/2-radius/2);
					context.arc(drawStruct.left+drawStruct.width/2, drawStruct.top+drawStruct.height/2, radius/2, -Math.PI/2, Math.PI, false);
					context.lineTo(drawStruct.left+drawStruct.width/2, drawStruct.top+drawStruct.height/2);
					context.lineTo(drawStruct.left+drawStruct.width/2, drawStruct.top+drawStruct.height/2+radius/2);
					context.stroke();
					break;
				case 1:
					context.moveTo(drawStruct.left+drawStruct.width/2, drawStruct.top+drawStruct.height/2-radius/2);
					context.arc(drawStruct.left+drawStruct.width/2, drawStruct.top+drawStruct.height/2, radius/2, -Math.PI/2, 0, true);
					context.lineTo(drawStruct.left+drawStruct.width/2, drawStruct.top+drawStruct.height/2);
					context.lineTo(drawStruct.left+drawStruct.width/2, drawStruct.top+drawStruct.height/2+radius/2);
					context.stroke();
					break;
				case 2:
					context.moveTo(drawStruct.left+drawStruct.width/2+radius/2, drawStruct.top+drawStruct.height/2);
					context.arc(drawStruct.left+drawStruct.width/2, drawStruct.top+drawStruct.height/2, radius/2, 0, Math.PI/2, true);
					context.lineTo(drawStruct.left+drawStruct.width/2, drawStruct.top+drawStruct.height/2);
					context.lineTo(drawStruct.left+drawStruct.width/2-radius/2, drawStruct.top+drawStruct.height/2);
					context.stroke();
					break;
				case 3:
					context.moveTo(drawStruct.left+drawStruct.width/2-radius/2, drawStruct.top+drawStruct.height/2);
					context.arc(drawStruct.left+drawStruct.width/2, drawStruct.top+drawStruct.height/2, radius/2, Math.PI, Math.PI/2, false);
					context.lineTo(drawStruct.left+drawStruct.width/2, drawStruct.top+drawStruct.height/2);
					context.lineTo(drawStruct.left+drawStruct.width/2+radius/2, drawStruct.top+drawStruct.height/2);
					context.stroke();
					break;
				default:
					break;
			}
			break;
		case 205:
			if (!drawStruct.yx) {
				context.strokeStyle="yellow";
				context.fillStyle=jsRgb(65408);
				context.fillRect(drawStruct.left, drawStruct.top, drawStruct.width, drawStruct.height);
			}
			break;
		case 206:
			// var img = new Image();   // 创建一个<img>元素
			// img.onload = function(){
			// 	context.drawImage(img, drawStruct.left, drawStruct.top, drawStruct.width, drawStruct.height);
			// }
			// img.src = "/profile/zhfh/" + drawStruct.fileName; // 设置图片源地址
			var src= api.url+"/profile/zhfh/" + drawStruct.fileName;// 设置图片源地址
			wx.downloadFile({
				url: src,
				success: (res) => {
					let img = res.tempFilePath;
					context.drawImage(img, drawStruct.left, drawStruct.top, drawStruct.width, drawStruct.height);
				}
			})

			break;
		case 207:
			if (drawStruct.dTranparent==1) {
				context.fillRect(drawStruct.left+drawStruct.width/6, drawStruct.top, drawStruct.width/2, drawStruct.height);
			}
			if (!drawStruct.yx) {
				context.fillStyle = jsRgb(drawStruct.color);
			} else {
				context.fillStyle='red';
				context.strokeStyle='red';
			}
			context.beginPath();
			context.arc(drawStruct.left+drawStruct.width/15, drawStruct.top+drawStruct.height/2, drawStruct.width/15,0,Math.PI*2,true);
			context.arc(drawStruct.left+drawStruct.width*14/15, drawStruct.top+drawStruct.height/2, drawStruct.width/15,0,Math.PI*2,true);
			context.fill();
			drawLine(context, drawStruct.left+drawStruct.width/15 , drawStruct.top+drawStruct.height/2, drawStruct.left+drawStruct.width*14/15, drawStruct.top+drawStruct.height/15);
			break;
		case 210:
			if (drawStruct.yk1==0) {
				if (!drawStruct.yx) {
					context.strokeStyle="yellow";
					context.fillStyle=jsRgb(65408);
				} else {
					context.strokeStyle="yellow";
					context.fillStyle="red";
				}
			} else if (drawStruct.yk1==1) {
				context.strokeStyle=jsRgb(0X00880015);
				context.fillStyle=jsRgb(0X00880015);
			} else {
				context.strokeStyle=jsRgb(0X004080FF);
				context.fillStyle=jsRgb(0X004080FF);
			}
			if (drawStruct.fileName=="") {
				context.fillRect(drawStruct.left,drawStruct.top,drawStruct.width,drawStruct.height);
				clickXY.push({x: drawStruct.left,y: drawStruct.top,w: drawStruct.width,h: drawStruct.height,f: drawStruct.fileName,c: drawStruct.mpyclass,d: drawStruct.xuHao})
			} else {
				context.font = drawStruct.fontSize + "px " + drawStruct.fontName;
				if (drawStruct.mpyBtStart==1) {// 左
					context.fillRect(drawStruct.left+2*drawStruct.width/3-1,drawStruct.top,drawStruct.width/3,drawStruct.height);
					context.fillStyle = jsRgb(drawStruct.fontColor);
					context.fillText(drawStruct.fileName,  drawStruct.left, drawStruct.top+ drawStruct.height/2)
					clickXY.push({x: drawStruct.left+2*drawStruct.width/3-1,y: drawStruct.top,w: drawStruct.width/3,h: drawStruct.height,f:   drawStruct.fileName,c: drawStruct.mpyclass,d: drawStruct.xuHao})
				}else if (drawStruct.mpyBtStart==2) {// 上
					context.fillRect(drawStruct.left+4,drawStruct.top+drawStruct.height/2.5,drawStruct.width/1.5,drawStruct.height/2);
					context.fillStyle = jsRgb(drawStruct.fontColor);
					context.fillText(drawStruct.fileName,  drawStruct.left+drawStruct.width/3, drawStruct.top+drawStruct.height/3)
					clickXY.push({x: drawStruct.left+4,y: drawStruct.top+drawStruct.height/2.5,w: drawStruct.width/1.5,h: drawStruct.height/2,f:   drawStruct.fileName,c: drawStruct.mpyclass,d: drawStruct.xuHao})
				}else if (drawStruct.mpyBtStart==3) {// 下
					context.fillRect(drawStruct.left+4,drawStruct.top,drawStruct.width/1.5,drawStruct.height/2);
					context.fillStyle = jsRgb(drawStruct.fontColor);
					context.fillText(drawStruct.fileName,  drawStruct.left+ drawStruct.width/3, drawStruct.top+ drawStruct.height/2);
					clickXY.push({x: drawStruct.left+4,y: drawStruct.top,w: drawStruct.width/1.5,h: drawStruct.height/2,f: drawStruct.fileName,c: drawStruct.mpyclass,d: drawStruct.xuHao})
				}else {// 右
					context.fillRect(drawStruct.left,drawStruct.top,drawStruct.width/3,drawStruct.height);
					context.fillStyle = jsRgb(drawStruct.fontColor);
					context.textAlign="center";
					context.textBaseline="middle";
					context.fillText(drawStruct.fileName,  drawStruct.left+ drawStruct.width*2/3, drawStruct.top+ drawStruct.height/2);
					clickXY.push({x: drawStruct.left,y: drawStruct.top,w: drawStruct.width/3,h: drawStruct.height,f: drawStruct.fileName,c: drawStruct.mpyclass,d: drawStruct.xuHao})
				}
			}
			break;
		case 211:
			if (drawStruct.dTranparent==1) {
				context.clearRect(drawStruct.left, drawStruct.top, drawStruct.width, drawStruct.height);
			}
			if (drawStruct.width>drawStruct.height) {
				ar= drawStruct.height/9;
			} else {
				ar= drawStruct.width/9;
			}
			if (!drawStruct.yx) {
				if (drawStruct.fileName=="") {
					context.fillStyle=jsRgb(drawStruct.color2);
					context.beginPath();
					context.arc(drawStruct.left+ drawStruct.width/2-ar, drawStruct.top+1, drawStruct.width/10,0,Math.PI*2,true);
					context.arc(drawStruct.left+ drawStruct.width/2-ar, drawStruct.top+drawStruct.height-2*ar, drawStruct.width/10,0,Math.PI*2,true);
					context.fill();
					context.beginPath();
					context.moveTo(drawStruct.left+ drawStruct.width/2, drawStruct.top+ drawStruct.height-2*ar);
					context.lineTo(drawStruct.left+ drawStruct.width/2+2*ar, drawStruct.top+2*ar);
					context.stroke();
				}else{
					if (drawStruct.mpyBtStart==1){
						context.beginPath();
						context.arc(drawStruct.left+ drawStruct.width/1.2-ar-2, drawStruct.top+1, drawStruct.width/20,0,Math.PI*2,true);
						context.fillStyle=jsRgb(drawStruct.color);
						context.fill();
						context.beginPath();
						context.arc(drawStruct.left+ drawStruct.width/1.2-ar-2, drawStruct.top+drawStruct.height-2*ar, drawStruct.width/20,0,Math.PI*2,true);
						context.fill();
						drawLine(context, drawStruct.left+ drawStruct.width/1.2, drawStruct.top+ drawStruct.height-2*ar, drawStruct.left+ drawStruct.width/1.2+2*ar, drawStruct.top);
						context.fillStyle = jsRgb(drawStruct.fontColor);
						context.font = drawStruct.fontSize + "px " + drawStruct.fontName;
						context.textAlign="center";
						context.fillText(drawStruct.fileName, drawStruct.left+ drawStruct.width/2.5, drawStruct.top+ drawStruct.height/2);
					}else if(drawStruct.mpyBtStart==2){
						context.beginPath();
						context.arc(drawStruct.left+ drawStruct.width/4-ar-2, drawStruct.top+1, drawStruct.width/20,0,Math.PI*2,true);
						context.fillStyle=jsRgb(drawStruct.color);
						context.fill();
						context.beginPath();
						context.arc(drawStruct.left+ drawStruct.width/4-ar-2, drawStruct.top+drawStruct.height-2*ar, drawStruct.width/20,0,Math.PI*2,true);
						context.fill();
						drawLine(context, drawStruct.left+ drawStruct.width/4-ar-2, drawStruct.top+ drawStruct.height-2*ar, drawStruct.left+ drawStruct.width/4+2*ar, drawStruct.top+2*ar);
						context.fillStyle = jsRgb(drawStruct.fontColor);
						context.font = drawStruct.fontSize + "px " + drawStruct.fontName;
						context.textAlign="center";
						context.fillText(drawStruct.fileName, drawStruct.left+ drawStruct.width/2, drawStruct.top+ drawStruct.height/2);
					}else if(drawStruct.mpyBtStart==3) {
						context.beginPath();
						context.arc(drawStruct.left+ drawStruct.width/4-ar-2, drawStruct.top+1, drawStruct.width/20,0,Math.PI*2,true);
						context.fillStyle=jsRgb(drawStruct.color);
						context.fill();
						context.beginPath();
						context.arc(drawStruct.left+ drawStruct.width/4-ar-2, drawStruct.top+drawStruct.height-2*ar, drawStruct.width/20,0,Math.PI*2,true);
						context.fill();
						drawLine(context, drawStruct.left+ drawStruct.width/4-ar-2, drawStruct.top+ drawStruct.height-2*ar, drawStruct.left+ drawStruct.width/4+2*ar, drawStruct.top+2*ar);
						context.fillStyle = jsRgb(drawStruct.fontColor);
						context.font = drawStruct.fontSize + "px " + drawStruct.fontName;
						context.textAlign="center";
						context.fillText(drawStruct.fileName, drawStruct.left+ drawStruct.width/2, drawStruct.top+ drawStruct.height/2);
					} else {
						context.beginPath();
						context.arc(drawStruct.left+ drawStruct.width/4-ar, drawStruct.top+1, drawStruct.width/20,0,Math.PI*2,true);
						context.fillStyle=jsRgb(drawStruct.color);
						context.fill();
						context.beginPath();
						context.arc(drawStruct.left+ drawStruct.width/4-ar, drawStruct.top+drawStruct.height-2*ar, drawStruct.width/20,0,Math.PI*2,true);
						context.fill();
						drawLine(context, drawStruct.left+ drawStruct.width/4-ar, drawStruct.top+ drawStruct.height-2*ar, drawStruct.left+ drawStruct.width/4+2*ar, drawStruct.top+2*ar);
						context.fillStyle = jsRgb(drawStruct.fontColor);
						context.font = drawStruct.fontSize + "px " + drawStruct.fontName;
						context.textAlign="center";
						context.fillText(drawStruct.fileName, drawStruct.left+ drawStruct.width/2, drawStruct.top+ drawStruct.height/2);
					}
				}
			}else{
				if (drawStruct.fileName=="") {
					context.fillStyle=jsRgb(drawStruct.color2);
					context.beginPath();
					context.arc(drawStruct.left+ drawStruct.width/2-ar, drawStruct.top+1, drawStruct.width/10,0,Math.PI*2,true);
					context.arc(drawStruct.left+ drawStruct.width/2-ar, drawStruct.top+drawStruct.height-2*ar, drawStruct.width/10,0,Math.PI*2,true);
					context.fill();
					context.beginPath();
					context.moveTo(drawStruct.left+ drawStruct.width/2, drawStruct.top+ drawStruct.height-2*ar);
					context.lineTo(drawStruct.left+ drawStruct.width/2, drawStruct.top);
					context.stroke();
				}else{
					if (drawStruct.mpyBtStart==1){
						context.beginPath();
						context.arc(drawStruct.left+ drawStruct.width/1.2-ar-2, drawStruct.top+1, drawStruct.width/20,0,Math.PI*2,true);
						context.fillStyle=jsRgb(drawStruct.color);
						context.fill();
						context.beginPath();
						context.arc(drawStruct.left+ drawStruct.width/1.2-ar-2, drawStruct.top+drawStruct.height-2*ar, drawStruct.width/20,0,Math.PI*2,true);
						context.fill();
						drawLine(context, drawStruct.left+ drawStruct.width/1.2, drawStruct.top+ drawStruct.height-2*ar, drawStruct.left+ drawStruct.width/1.2, drawStruct.top);
						context.fillStyle = jsRgb(drawStruct.fontColor);
						context.font = drawStruct.fontSize + "px " + drawStruct.fontName;
						context.textAlign="center";
						context.fillText(drawStruct.fileName, drawStruct.left+ drawStruct.width/2.5, drawStruct.top+ drawStruct.height/2);
					}else if(drawStruct.mpyBtStart==2){
						context.beginPath();
						context.arc(drawStruct.left+ drawStruct.width/4-ar-2, drawStruct.top+1, drawStruct.width/20,0,Math.PI*2,true);
						context.fillStyle=jsRgb(drawStruct.color);
						context.fill();
						context.beginPath();
						context.arc(drawStruct.left+ drawStruct.width/4-ar-2, drawStruct.top+drawStruct.height-2*ar, drawStruct.width/20,0,Math.PI*2,true);
						context.fill();
						drawLine(context, drawStruct.left+ drawStruct.width/4-ar-2, drawStruct.top+ drawStruct.height-2*ar, drawStruct.left+ drawStruct.width/4+2*ar, drawStruct.top+2*ar);
						context.fillStyle = jsRgb(drawStruct.fontColor);
						context.font = drawStruct.fontSize + "px " + drawStruct.fontName;
						context.textAlign="center";
						context.fillText(drawStruct.fileName, drawStruct.left+ drawStruct.width/2, drawStruct.top+ drawStruct.height/2);
					}else if(drawStruct.mpyBtStart==3) {
						context.beginPath();
						context.arc(drawStruct.left+ drawStruct.width/4-ar-2, drawStruct.top+1, drawStruct.width/20,0,Math.PI*2,true);
						context.fillStyle=jsRgb(drawStruct.color);
						context.fill();
						context.beginPath();
						context.arc(drawStruct.left+ drawStruct.width/4-ar-2, drawStruct.top+drawStruct.height-2*ar, drawStruct.width/20,0,Math.PI*2,true);
						context.fill();
						drawLine(context, drawStruct.left+ drawStruct.width/4-ar-2, drawStruct.top+ drawStruct.height-2*ar, drawStruct.left+ drawStruct.width/4+2*ar, drawStruct.top+2*ar);
						context.fillStyle = jsRgb(drawStruct.fontColor);
						context.font = drawStruct.fontSize + "px " + drawStruct.fontName;
						context.textAlign="center";
						context.fillText(drawStruct.fileName, drawStruct.left+ drawStruct.width/2, drawStruct.top+ drawStruct.height/2);
					} else {
						context.beginPath();
						context.arc(drawStruct.left+ drawStruct.width/4-ar, drawStruct.top+1, drawStruct.width/20,0,Math.PI*2,true);
						context.fillStyle=jsRgb(drawStruct.color);
						context.fill();
						context.beginPath();
						context.arc(drawStruct.left+ drawStruct.width/4-ar, drawStruct.top+drawStruct.height-2*ar, drawStruct.width/20,0,Math.PI*2,true);
						context.fill();
						drawLine(context, drawStruct.left+ drawStruct.width/4-ar, drawStruct.top+ drawStruct.height-2*ar, drawStruct.left+ drawStruct.width/4+2*ar, drawStruct.top+2*ar);
						context.fillStyle = jsRgb(drawStruct.fontColor);
						context.font = drawStruct.fontSize + "px " + drawStruct.fontName;
						context.textAlign="center";
						context.fillText(drawStruct.fileName, drawStruct.left+ drawStruct.width/2, drawStruct.top+ drawStruct.height/2);
					}
				}
			}
			break;
		case 212:
			context.fillStyle=jsRgb(drawStruct.bkColor);
			context.fillRect(drawStruct.left, drawStruct.top+ drawStruct.height/4, drawStruct.width, drawStruct.height/4);
			context.lineWidth=1;
			if (drawStruct.yk1==0) {
				if (drawStruct.yx) {
					context.strokeStyle = "red";
				} else {
					context.strokeStyle = jsRgb(65408);
				}
			} else if (drawStruct.yk1==1) {
				context.strokeStyle=jsRgb(0X00880015);
			} else {
				context.strokeStyle=jsRgb(0X004080FF);
			}
			var ar = drawStruct.width/6;
			context.beginPath();
			context.moveTo(drawStruct.left+(drawStruct.width/2)-2*ar , drawStruct.top+ drawStruct.height/2);
			context.lineTo(drawStruct.left+ drawStruct.width/2, drawStruct.top+ drawStruct.height/4);
			context.lineTo(drawStruct.left+ drawStruct.width/2+2*ar, drawStruct.top+ drawStruct.height/2);
			context.moveTo(drawStruct.left+ drawStruct.width/2+2*ar, drawStruct.top+ drawStruct.height*3/4);
			context.lineTo(drawStruct.left+ drawStruct.width/2, drawStruct.top+ drawStruct.height/2);
			context.lineTo(drawStruct.left+ drawStruct.width/2-2*ar, drawStruct.top+ drawStruct.height*3/4);
			context.stroke();
			break;
		case 214:
			context.lineWidth=1;
			if (drawStruct.yk1==0) {
				if (drawStruct.yx) {
					context.strokeStyle = "red";
				} else {
					context.strokeStyle = jsRgb(65408);
				}
			} else if (drawStruct.yk1==1) {
				context.strokeStyle=jsRgb(0X00880015);
			} else {
				context.strokeStyle=jsRgb(0X004080FF);
			}
			var ar = drawStruct.width/6;
			context.fillStyle=jsRgb(drawStruct.bkColor);
			context.fillRect(drawStruct.left, drawStruct.top+drawStruct.height/2, drawStruct.width, drawStruct.height/4);
			context.beginPath();
			context.moveTo(drawStruct.left+(drawStruct.width/2)-2*ar , drawStruct.top+ drawStruct.height/4);
			context.lineTo(drawStruct.left+ drawStruct.width/2, drawStruct.top+ drawStruct.height/2);
			context.lineTo(drawStruct.left+ drawStruct.width/2+2*ar, drawStruct.top+ drawStruct.height/4);
			context.moveTo(drawStruct.left+ drawStruct.width/2+2*ar, drawStruct.top+ drawStruct.height/2);
			context.lineTo(drawStruct.left+ drawStruct.width/2, drawStruct.top+ drawStruct.height*3/4);
			context.lineTo(drawStruct.left+ drawStruct.width/2-2*ar, drawStruct.top+ drawStruct.height/2);
			context.stroke();
			break;
		/**继远02出线柜*/
		case 215:
			context.lineWidth=1;
			if (drawStruct.yk1==0) {
				if (drawStruct.yx) {
					context.strokeStyle = "red";
				} else {
					context.strokeStyle = jsRgb(65408);
				}
			} else if (drawStruct.yk1==1) {
				context.strokeStyle=jsRgb(0X00880015);
			} else {
				context.strokeStyle=jsRgb(0X004080FF);
			}
			var ar = drawStruct.height/6;
			context.fillStyle=jsRgb(drawStruct.bkColor);
			context.fillRect(drawStruct.left+drawStruct.width/4, drawStruct.top, drawStruct.width/4, drawStruct.height);
			context.beginPath();
			context.moveTo(drawStruct.left+ drawStruct.width/2, drawStruct.top+ drawStruct.height/2-2*ar);
			context.lineTo(drawStruct.left+drawStruct.width/4 , drawStruct.top+ drawStruct.height/2);
			context.lineTo(drawStruct.left+ drawStruct.width/2, drawStruct.top+ drawStruct.height/2+2*ar);
			context.moveTo(drawStruct.left+ drawStruct.width*3/4, drawStruct.top+ drawStruct.height/2-2*ar);
			context.lineTo(drawStruct.left+ drawStruct.width/2, drawStruct.top+ drawStruct.height/2);
			context.lineTo(drawStruct.left+ drawStruct.width*3/4, drawStruct.top+ drawStruct.height/2+2*ar);
			context.stroke();
			break;
		case 216:
			context.lineWidth=1;
			if (drawStruct.yk1==0) {
				if (drawStruct.yx) {
					context.strokeStyle = "red";
				} else {
					context.strokeStyle = jsRgb(65408);
				}
			} else if (drawStruct.yk1==1) {
				context.strokeStyle=jsRgb(0X00880015);
			} else {
				context.strokeStyle=jsRgb(0X004080FF);
			}
			var ar = drawStruct.height/6;
			context.fillStyle=jsRgb(drawStruct.bkColor);
			context.fillRect(drawStruct.left+drawStruct.width/2, drawStruct.top, drawStruct.width/4, drawStruct.height);
			context.beginPath();
			context.moveTo(drawStruct.left+ drawStruct.width/4, drawStruct.top+ drawStruct.height/2-2*ar);
			context.lineTo(drawStruct.left+drawStruct.width/2 , drawStruct.top+ drawStruct.height/2);
			context.lineTo(drawStruct.left+ drawStruct.width/4, drawStruct.top+ drawStruct.height/2+2*ar);
			context.moveTo(drawStruct.left+ drawStruct.width/2, drawStruct.top+ drawStruct.height/2-2*ar);
			context.lineTo(drawStruct.left+ drawStruct.width*3/4, drawStruct.top+ drawStruct.height/2);
			context.lineTo(drawStruct.left+ drawStruct.width/2, drawStruct.top+ drawStruct.height/2+2*ar);
			context.stroke();
			break;
		case 233:
			if (drawStruct.dTranparent==1) {
				context.fillRect(drawStruct.left, drawStruct.top, drawStruct.width, drawStruct.height);
			}
			context.beginPath();
			if (drawStruct.yx) {
				context.strokeStyle = "green";
			} else {
				context.strokeStyle = "red";
			}
			context.arc(drawStruct.left+ drawStruct.width, drawStruct.top+ drawStruct.height,Math.min(drawStruct.width/2, drawStruct.height/2),0,Math.PI*2,true);
			context.stroke();
			break;
		case 236:
			if (drawStruct.width>drawStruct.height) {
				ar= drawStruct.height/9;
			} else {
				ar= drawStruct.width/9;
			}
			context.fillStyle=jsRgb(drawStruct.color2);
			context.beginPath();
			context.arc(drawStruct.left+ ar, drawStruct.top + drawStruct.height/2, drawStruct.width/10, 0, Math.PI*2, true);
			context.arc(drawStruct.left+ drawStruct.width - ar, drawStruct.top + drawStruct.height/2, drawStruct.width/10, 0, Math.PI*2, true);
			context.fill();
			context.beginPath();
			context.moveTo(drawStruct.left + drawStruct.width - ar, drawStruct.top + drawStruct.height/2);
			context.lineTo(drawStruct.left + 2*ar, drawStruct.top + 2*ar);
			context.stroke();
			break;
		case 237:
			context.fillStyle = jsRgb(drawStruct.bkColor);
			context.fillRect(drawStruct.left-1, drawStruct.top, drawStruct.width+1, drawStruct.height);
			context.fillStyle = jsRgb(drawStruct.fontColor);
			context.font = drawStruct.fontSize+2 + "px " + drawStruct.fontName;
			context.textAlign="center";
			context.textBaseline="middle";
			context.fillText(drawStruct.caption, drawStruct.left + drawStruct.width/2, drawStruct.top + drawStruct.height/2);
			break;
		case 238:
			context.clearRect(drawStruct.left, drawStruct.top+1, drawStruct.width-4, drawStruct.height-2);
			context.fillStyle = jsRgb(drawStruct.fontColor);
			context.font = drawStruct.fontSize + "px " + drawStruct.fontName;
			context.textAlign="left";
			context.textBaseline="top";
			context.fillText(drawStruct.title + drawStruct.data + drawStruct.fileName, drawStruct.left, drawStruct.top, drawStruct.width-4);
			break;
		case 264:
			var r=Math.min(drawStruct.width/2, drawStruct.height/2);
			context.fillRect(drawStruct.left, drawStruct.top, drawStruct.width, drawStruct.height);
			context.beginPath();
			context.arc(drawStruct.left+ drawStruct.width/2, drawStruct.top+ drawStruct.height/2,r,0,Math.PI*2,true);
			context.moveTo(drawStruct.left+ drawStruct.width/2-r/Math.sqrt(2), drawStruct.top+ drawStruct.height/2-r/Math.sqrt(2));
			context.lineTo(drawStruct.left+ drawStruct.width/2+r/Math.sqrt(2), drawStruct.top+ drawStruct.height/2+r/Math.sqrt(2));
			context.moveTo(drawStruct.left+ drawStruct.width/2+r/Math.sqrt(2), drawStruct.top+ drawStruct.width/2-r/Math.sqrt(2));
			context.lineTo(drawStruct.left+ drawStruct.width/2-r/Math.sqrt(2), drawStruct.top+ drawStruct.width/2+r/Math.sqrt(2));
			context.stroke();
			break;
		case 265:
			var ar=6*(drawStruct.height-4)/ drawStruct.width;
			var ac=3*drawStruct.width/(drawStruct.height-4)/2;
			context.beginPath();
			context.moveTo(drawStruct.left+ drawStruct.width/2, drawStruct.top);
			context.lineTo(drawStruct.left+ drawStruct.width/4+ac, drawStruct.top+ (drawStruct.height-4)/2-3);
			context.moveTo(drawStruct.left+ drawStruct.width/4+ac-ar, drawStruct.top+ (drawStruct.height-4)/2-6);
			context.lineTo(drawStruct.left+ drawStruct.width/4+ac+ar, drawStruct.top+ (drawStruct.height-4)/2);
			context.moveTo(drawStruct.left+ drawStruct.width/4-ac-ar, drawStruct.top+ (drawStruct.height-4)/2);
			context.lineTo(drawStruct.left+ drawStruct.width/4-ac+ar, drawStruct.top+ (drawStruct.height-4)/2+6);
			context.moveTo(drawStruct.left+ drawStruct.width/4-ac, drawStruct.top+ (drawStruct.height-4)/2+3);
			context.lineTo(drawStruct.left, drawStruct.top+ drawStruct.height-4);
			context.lineTo(drawStruct.left+ drawStruct.width/2-4, drawStruct.top+ drawStruct.height-2);
			context.moveTo(drawStruct.left+ drawStruct.width/2-4, drawStruct.top+ drawStruct.height-6);
			context.lineTo(drawStruct.left+ drawStruct.width/2-4, drawStruct.top+ drawStruct.height+2);
			context.moveTo(drawStruct.left+ drawStruct.width/2+4, drawStruct.top+ drawStruct.height-6);
			context.lineTo(drawStruct.left+ drawStruct.width/2+4, drawStruct.top+ drawStruct.height+2);
			context.moveTo(drawStruct.left+ drawStruct.width/2+4, drawStruct.top+ drawStruct.height-2);
			context.lineTo(drawStruct.left+ drawStruct.width, drawStruct.top+ drawStruct.height-2);
			context.lineTo(drawStruct.left+ drawStruct.width*3/4+ac, drawStruct.top+ drawStruct.height/2+3);
			context.moveTo(drawStruct.left+ drawStruct.width*3/4+ac+ar, drawStruct.top+ drawStruct.height/2);
			context.lineTo(drawStruct.left+ drawStruct.width*3/4+ac-ar, drawStruct.top+ drawStruct.height/2+6);
			context.moveTo(drawStruct.left+ drawStruct.width*3/4-ac+ar, drawStruct.top+ drawStruct.height/2-6);
			context.lineTo(drawStruct.left+ drawStruct.width*3/4-ac-ar, drawStruct.top+ drawStruct.height/2);
			context.moveTo(drawStruct.left+ drawStruct.width*3/4-ac, drawStruct.top+ drawStruct.height/2-6);
			context.lineTo(drawStruct.left+ drawStruct.width/2, drawStruct.top);
			context.stroke();
			break;
		default:
			break;
	}
}
